#ifndef _H_DDS_
#define _H_DDS_
#include "define.h"
#define DAC_TIMER TIM6
#define DAC_GPIO_PORT GPIOA
#define DAC_GPIO_PIN 4

#define DDS_DEFAULT_FREQ (float)(1000)
typedef struct{
	U32 pr;
	U32 freq;
	U32 samples;
	U32 amp;
	U32 arr;
	U8 start;
	float samplepointperperiod;
	
}STRDACRegType;
extern STRDACRegType g_dac_stRegs; 
extern void dac_init(void);
extern void dac_startdds(U32 freq, U16 amp);
extern void dac_stopdds(void);
extern U8 dac_isstart(void);
extern void dac_startdds_byfs(float fs, float *dmabuff, U16 size);
#define dac_timeren()  do {\
DAC_TIMER->CR1 |= TIM_CR1_CEN;\
} while(0)


#define dac_timerdis()  DAC_TIMER->CR1 &= (~TIM_CR1_CEN);

//DAC->CR &= ~DAC_CR_BOFF1;
//DAC->CR |= DAC_CR_TEN1;
#endif